<template>
  <div class="tw-main">
    <div class="screen">
      <ul class="tw-hero">
        <li v-for="item in hero" v-bind:key="item.id">
          <span class="tw-hero__label">{{item.label}}</span>
          <span class="tw-hero__value">{{item.value}}</span>
        </li>
      </ul>
      <el-row class="tw-grid">
        <el-col
          class="tw-grid__left"
          :lg="16"
          :md="24"
        >
          <tw-card
            :label="$t('m.techingBehavoralynsys')"
          >
            <el-row>
              <el-col :span="4">
                <div class="tw-info-box">
                  <div class="tw-info-box__layout">
                    <p class="tw-info-box__label">{{$t('m.teacherUserRatio')}}</p>
                    <p class="tw-info-box__value">{{teacherUseRate}}</p>
                  </div>
                </div>
                <div class="tw-info-box">
                  <div class="tw-info-box__layout">
                    <p class="tw-info-box__label">{{$t('m.lessonCount')}}({{$t('m.month')}})</p>
                    <p class="tw-info-box__value">{{lectureCount}}</p>
                  </div>
                </div>
              </el-col>
              <el-col :span="20">
                <tw-echarts
                  id="echarts_teacherClassBehavior"
                  ref="echarts_teacherClassBehavior"
                  :additionalOptions="additionalOptions['echarts_teacherClassBehavior']"
                  height="35vh"
                  @finishCharts="simulationTime"
                ></tw-echarts>
              </el-col>
            </el-row>
          </tw-card>
        </el-col>
        <el-col
          class="tw-grid__right"
          :lg="8"
          :md="24"
        >
          <tw-card
            :label="$t('m.teachResultAndLessonActive')"
          >
            <tw-echarts
              id="echarts_classActivity"
              ref="echarts_classActivity"
              :additionalOptions="additionalOptions['echarts_classActivity']"
              height="35vh"
            ></tw-echarts>
          </tw-card>
        </el-col>
      </el-row>
      <el-row class="tw-grid">
        <el-col
          :lg="8"
          :md="24"
          class="tw-grid__flow flow_1">
          <tw-card
          :label="$t('m.lessonActSta')"
          >
            <tw-echarts
              id="echarts_classInteraction"
              ref="echarts_classInteraction"
              :additionalOptions="additionalOptions['echarts_classInteraction']"
              height="33vh"
            ></tw-echarts>
          </tw-card>
        </el-col>
        <el-col
          :lg="8"
          :md="12"
          class="tw-grid__flow flow_2">
          <tw-card
          :label="$t('m.teachToolSta')"
          :rightLabel="toolTotalCount"
          >
            <tw-dist-box :distBox="distBox"></tw-dist-box>
          </tw-card>
        </el-col>
        <el-col
          :lg="8"
          :md="12"
          class="tw-grid__flow flow_3">
          <tw-card
            :label="$t('m.lessonScoreCoverSta')"
          >
            <tw-echarts
              id="echarts_classScoreDistribution"
              ref="echarts_classScoreDistribution"
              :additionalOptions="additionalOptions['echarts_classScoreDistribution']"
              height="33vh"
              @finishCharts="simulationTime"
            ></tw-echarts>
          </tw-card>
        </el-col>
      </el-row>
    </div>
    <div class="screen">
      <ul class="tw-hero" v-show="responsiveHero">
        <li v-for="item in hero1" v-bind:key="item.id">
          <span class="tw-hero__label">{{item.label}}</span>
          <span class="tw-hero__value">{{item.value}}</span>
        </li>
      </ul>
      <el-row class="tw-grid">
        <el-col :md="24" :lg="9" class="tw-grid__left" >
          <tw-card
          :label="$t('m.homeworkAssignAndFinishSta')"
          >
            <div class="table-layout" style="padding: 20px;height: 33vh">
              <el-table
                :data="tableData"
                style="width: 100%"
                class="tw-customer-table"
                row-class-name="tw-customer-table-row"
                header-row-class-name="tw-customer-table-header">
                <el-table-column
                  :label="$t('m.homeworkType')"
                  :width="typeWidth">
                  <template slot-scope="scope">
                    <img :src="'/static/weishidataview/images/' + scope.row.url" alt="img">
                    <span style="margin-left: 10px">{{ scope.row.type }}</span>
                  </template>
                </el-table-column>
                <el-table-column

                  :label="$t('m.assign') + '/' + $t('m.submit')">
                  <template slot-scope="scope">
                    <p :title="scope.row.situation">{{scope.row.situation}}</p>
                  </template>
                </el-table-column>
                <el-table-column :label="$t('m.finishRatio')" :width="finishWidth">
                  <template slot-scope="scope">
                    <span class="yellow">{{scope.row.finish}}%</span>
                    <tw-circle
                      :percent="scope.row.finish"
                      :id="scope.row.id"
                    ></tw-circle>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </tw-card>
        </el-col>
        <el-col :md="24" :lg="15" class="tw-grid__right">
          <tw-card
          :label="$t('m.studentLessonPerformance')"
          >
            <tw-echarts
              id="echarts_studentClassBehavior"
              ref="echarts_studentClassBehavior"
              :additionalOptions="additionalOptions['echarts_studentClassBehavior']"
              height="33vh"
              @finishCharts="simulationTime1"
            ></tw-echarts>
          </tw-card>
        </el-col>
      </el-row>
      <el-row class="tw-grid">
        <el-col :span="24" class="tw-grid__single">
          <tw-card
          :label="$t('m.teachResultSta')"
          >
            <el-row>
              <el-col :span="8" v-if="statistics.length > 0">
                <tw-statistics :statistics="statistics[0]"></tw-statistics>
              </el-col>
              <el-col :span="8" v-if="statistics.length > 1">
                <tw-statistics :statistics="statistics[1]"></tw-statistics>
              </el-col>
              <el-col :span="8" v-if="statistics.length > 2">
                <tw-statistics :statistics="statistics[2]"></tw-statistics>
              </el-col>
            </el-row>
          </tw-card>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script scoped>
import TwCard from '@/components/TwCard'
import TwEcharts from '@/components/TwEcharts'
import TwDistBox from '@/components/TwDistBox'
import TwCircle from '@/components/TwCircle'
import TwStatistics from '@/components/TwStatistics'
import configUtil from '@/config/config'
import echarts from 'echarts'

export default{
  created: function () {
    let vm = this
    // 初始值
    this.hero[0].value = 0
    this.hero[1].value = 0
    this.hero[2].value = 0
    this.hero[3].value = 0
    this.hero1[0].value = 0
    this.hero1[1].value = 0
    this.hero1[2].value = 0
    this.hero1[3].value = 0
    // 查找有效用户数
    let userRegisterReq = {'type': '1'}
    this.$axios.post(configUtil.getApiPath() + 'user/getUserRegisterThrend', userRegisterReq).then(response => {
      if (response && response.data.pageInfo.list && response.data.pageInfo.list.length > 0) {
        for (let i = 0; i < response.data.pageInfo.list.length; i++) {
          if (i === response.data.pageInfo.list.length - 1) {
            let value = response.data.pageInfo.list[i].teacherCount + response.data.pageInfo.list[i].studentCount + response.data.pageInfo.list[i].parentCount + response.data.pageInfo.list[i].otherCount
            if (value > 0) {
              this.hero[0].value = value
              this.hero1[0].value = value
            }
          }
        }
      }
    }, response => {
      console.log('getUserRegisterThrend error')
    })
    // 覆盖班级数 key: coverClassNumber 授课节数 key : lecturesNumber课例数 18,600 key:classNumber
    let constantReq = {}
    this.$axios.post(configUtil.getApiPath() + '/queryConstant', constantReq).then(response => {
      if (response && response.data.pageInfo.list && response.data.pageInfo.list.length > 0) {
        let data = response.data
        if (data) {
          if (data.pageInfo.list) {
            let lists = data.pageInfo.list
            for (let i = 0; i < lists.length; i++) {
              let itemkey = lists[i].itemkey
              let itemvalue = lists[i].itemvalue
              if (itemkey === 'coverClassNumber') {
                this.hero[1].value = itemvalue
                this.hero1[1].value = itemvalue
              }
              if (itemkey === 'lecturesNumber') {
                this.hero[2].value = itemvalue
                this.hero1[2].value = itemvalue
              }
              if (itemkey === 'classNumber') {
                this.hero[3].value = itemvalue
                this.hero1[3].value = itemvalue
              }
              if (itemkey === 'teacherUseRate') {
                this.teacherUseRate = itemvalue + '%'
              }
              if (itemkey === 'lectureCount') {
                this.lectureCount = itemvalue
              }
            }
          }
        }
      }
    }, response => {
      console.log('getUserRegisterThrend error')
    })
    // 教师课堂行为分析
    let queryBahaviorReq = {
      'type': 2,
      'recordtype': 2
    }
    this.$axios.post(configUtil.getApiPath() + 'queryBahavior', queryBahaviorReq).then(response => {
      let data = response.data
      if (data) {
        let result = {}
        result.note = '教师课堂行为分析'
        result.xAxisData = []
        result.seriesData = []
        if (data.pageInfo.list) {
          let lists = data.pageInfo.list
          let xAxisData = []
          let seriesData = []
          let dataList = []
          let dataJson = {}
          for (let i = 0; i < lists.length; i++) {
            let behavorname = lists[i].behavorname
            let usecount = lists[i].usecount
            xAxisData[i] = behavorname
            dataList[i] = usecount
          }
          if (dataList.length > 0) {
            dataJson.name = vm.$i18n.messages[vm.$i18n.locale].m.leiji
            dataJson.data = dataList
            seriesData[1] = dataJson
          }
          result.xAxisData = xAxisData
          result.seriesData = seriesData
        }
        this.additionalOptions.echarts_teacherClassBehavior = result
      }
    }, response => {
      console.log('error')
    })
    // 课堂活跃度分析，百分比为实际图例占比数，value为滑过显示值
    let ketangReq = {
      'type': 2,
      'recordtype': 2
    }
    this.$axios.post(configUtil.getApiPath() + 'queryBahavior', ketangReq).then(response => {
      let data = response.data
      if (data) {
        let result = {}
        result.note = '课堂活跃度分析，百分比为实际图例占比数，value为滑过显示值'
        result.seriesData = []
        if (data.pageInfo.list) {
          let lists = data.pageInfo.list
          let seriesData = []
          let usecountMax = 0
          let len = 6
          if (lists.length < 6) {
            len = lists.length
          }
          for (let i = 0; i < len; i++) {
            let usecount = lists[i].usecount
            if (usecount >= usecountMax) {
              usecountMax = usecount
            }
          }
          for (let i = 0; i < len; i++) {
            let dataJson = {}
            let behavorname = lists[i].behavorname
            let use = lists[i].usecount
            dataJson.name = behavorname
            let useValue
            if (i === 0) {
              dataJson.radius = ['112%', '120%']
              useValue = use / (usecountMax * 1.1)
            }
            if (i === 1) {
              dataJson.radius = ['92%', '100%']
              useValue = use / (usecountMax * 1.1)
            }
            if (i === 2) {
              dataJson.radius = ['72%', '80%']
              useValue = use / (usecountMax * 1.1)
            }
            if (i === 3) {
              dataJson.radius = ['52%', '60%']
              useValue = use / (usecountMax * 1.1)
            }
            if (i === 4) {
              dataJson.radius = ['32%', '40%']
              useValue = use / (usecountMax * 1.1)
            }
            let valueFloat = Number(useValue)
            dataJson.value = use
            dataJson.percentage = valueFloat.toFixed(2)
            seriesData[i] = dataJson
          }
          result.seriesData = seriesData
        }
        this.additionalOptions.echarts_classActivity = result
      }
    }, response => {
      console.log('error')
    })
    // 课堂互动情况
    let req = {
      'type': 2,
      'recordtype': 2
    }
    this.$axios.post(configUtil.getApiPath() + 'queryBahavior', req).then(response => {
      let data = response.data
      if (data) {
        let result = {}
        result.note = '课堂互动情况'
        result.seriesData = []
        if (data.pageInfo.list) {
          let lists = data.pageInfo.list
          let seriesData = []
          let len = 5
          if (lists.length < 5) {
            len = lists.length
          }
          for (let i = 0; i < len; i++) {
            let dataJson = {}
            let behavorname = lists[i].behavorname
            let usecount = lists[i].usecount
            dataJson.name = behavorname
            dataJson.value = usecount
            seriesData[i] = dataJson
          }
          result.seriesData = seriesData
        }
        this.additionalOptions.echarts_classInteraction = result
      }
    }, response => {
      console.log('error')
    })
    // 教学工具统计
    let jiaoXueReq = {
      'type': 2,
      'recordtype': 2
    }
    this.$axios.post(configUtil.getApiPath() + 'queryTeachToolRand', jiaoXueReq).then(response => {
      let data = response.data
      if (data) {
        let result = {}
        result.note = '授课工具概况'
        if (data.pageInfo.list) {
          let lists = data.pageInfo.list
          let len = 5
          if (lists.length < 5) {
            len = lists.length
          }
          let allCount = lists.length
          for (let i = 0; i < len; i++) {
            let usecount = lists[i].usecount
            let toolname = lists[i].toolname
            if (i === 0) {
              this.distBox.dist1 = toolname + ',' + usecount
            }
            if (i === 1) {
              this.distBox.dist2 = toolname + ',' + usecount
            }
            if (i === 2) {
              this.distBox.dist3 = toolname + ',' + usecount
            }
            if (i === 3) {
              this.distBox.dist4 = toolname + ',' + usecount
            }
            if (i === 4) {
              this.distBox.dist5 = toolname + ',' + usecount
            }
          }
          this.toolTotalCount = this.$i18n.messages[this.$i18n.locale].m.teachToolAll + ' : ' + allCount
        }
        // 添加后，删除不要的
        let dist1 = this.distBox.dist1
        console.log(dist1)
        if (dist1 === '无') {
          this.distBox = {}
        } else {
          var dist2 = this.distBox.dist2
          if (dist2 === '无') {
            delete this.distBox.dist2
          }
          var dist3 = this.distBox.dist3
          if (dist3 === '无') {
            delete this.distBox.dist3
          }
          var dist4 = this.distBox.dist4
          if (dist4 === '无') {
            delete this.distBox.dist4
          }
          var dist5 = this.distBox.dist5
          if (dist5 === '无') {
            delete this.distBox.dist5
          }
        }
      }
    }, response => {
      console.log('error')
    })
    // 课堂得分情况分布
    let reqscore = {}
    this.$axios.post(configUtil.getApiPath() + 'queryLessonScore', reqscore).then(response => {
      let data = response.data
      if (data) {
        let result = {}
        result.note = '课堂得分情况分布'
        result.seriesData = []
        if (data.pageInfo.list) {
          let lists = data.pageInfo.list
          let seriesData = []
          for (let i = 0; i < lists.length; i++) {
            let dataArray = []
            let avragescore = lists[i].avragescore
            let index = i + 1
            dataArray[0] = index * (40 / lists.length)
            dataArray[1] = avragescore
            seriesData[i] = dataArray
          }
          result.seriesData = seriesData
        }
        this.additionalOptions.echarts_classScoreDistribution = result
      }
    }, response => {
      console.log('error')
    })
    // 学生课堂表现
    let studentReq = {
      'type': 3,
      'recordtype': 2
    }
    this.$axios.post(configUtil.getApiPath() + 'queryBahavior', studentReq).then(response => {
      let data = response.data
      if (data) {
        let result = {}
        result.note = '学生课堂表现情况'
        result.seriesData = []
        if (data.pageInfo.list) {
          let lists = data.pageInfo.list
          let xAxisData = []
          let seriesData = []
          let dataList = []
          let dataJson = {}
          for (let i = 0; i < lists.length; i++) {
            let behavorname = lists[i].behavorname
            let usecount = lists[i].usecount
            xAxisData[i] = behavorname
            dataList[i] = usecount
          }
          if (xAxisData.length > 0) {
            dataJson.name = vm.$i18n.messages[vm.$i18n.locale].m.leiji
            dataJson.data = dataList
          }
          seriesData[1] = dataJson
          result.xAxisData = xAxisData
          result.seriesData = seriesData
        }
        this.additionalOptions.echarts_studentClassBehavior = result
      }
    }, response => {
      console.log('error')
    })
    // 作业布置与完成水平
    let taskFinishReq = {}
    this.$axios.post(configUtil.getApiPath() + 'queryTaskFinish', taskFinishReq).then(response => {
      let data = response.data
      if (data) {
        if (data.pageInfo.list) {
          let lists = data.pageInfo.list
          let resultData = []
          let len = 3
          if (lists.length < 3) {
            len = lists.length
          }
          for (let i = 0; i < len; i++) {
            let dataJson = {}
            let tasktypename = lists[i].tasktypename
            let assigncount = lists[i].assigncount
            let submitcount = lists[i].submitcount
            if (tasktypename === '作业') {
              dataJson.id = 'homework'
              dataJson.url = 'homework.png'
            } else if (tasktypename === '预习') {
              dataJson.id = 'preview'
              dataJson.url = 'preview.png'
            } else if (tasktypename === '智能检测') {
              dataJson.id = 'test'
              dataJson.url = 'test.png'
            } else {
              dataJson.id = 'exercise' + i
              dataJson.url = 'exercise.png'
            }
            dataJson.type = tasktypename
            dataJson.situation = assigncount + this.$i18n.messages[this.$i18n.locale].m.unitCi + '/' + submitcount + this.$i18n.messages[this.$i18n.locale].m.unitCi
            let valueFloat = Number((submitcount / assigncount) * 100)
            dataJson.finish = valueFloat
            resultData[i] = dataJson
          }
          this.tableData = resultData
        }
      }
    }, response => {
      console.log('error')
    })
    // 教学成果统计
    let teachResultReq = {
      'type': 3,
      'recordtype': 2
    }
    this.$axios.post(configUtil.getApiPath() + 'queryTeachResult', teachResultReq).then(response => {
      let data = response.data
      if (data) {
        // 微课成果
        let resultData = []
        if (data.pageInfo.list) {
          let lists = data.pageInfo.list
          let weiXinDataJson = {}
          weiXinDataJson.url = 'weike.png'
          let weiXinInfo = {}
          weiXinInfo.name = this.$i18n.messages[this.$i18n.locale].m.microLesson
          let weiXinAllCount = 0
          weiXinInfo.value = weiXinAllCount
          weiXinDataJson.info = weiXinInfo
          let weiXinTableData = {}
          let weiXintbodyArray = []
          let first = 0
          let len = 3
          if (lists.length < 3) {
            len = lists.length
          }
          for (let i = 0; i < len; i++) {
            let gradename = lists[i].gradename
            let resulttype = lists[i].resulttype
            let resultcount = lists[i].resultcount
            if (resulttype === '1') {
              let arrray = []
              arrray[0] = gradename
              arrray[1] = resultcount
              weiXintbodyArray[first] = arrray
              weiXinAllCount += resultcount
              first = first + 1
            }
          }
          weiXinInfo.value = weiXinAllCount
          weiXinDataJson.info = weiXinInfo
          weiXinDataJson.title = this.$i18n.messages[this.$i18n.locale].m.microLessonResult + '(' + this.$i18n.messages[this.$i18n.locale].m.month + ')TOP3'
          weiXinTableData.thead = [this.$i18n.messages[this.$i18n.locale].m.grade, this.$i18n.messages[this.$i18n.locale].m.num]
          weiXinTableData.tbody = weiXintbodyArray
          weiXinDataJson.tableData = weiXinTableData
          resultData[0] = weiXinDataJson
        }
        // 课件成果
        if (data.pageInfo.list) {
          let lists = data.pageInfo.list
          let keJianJson = {}
          keJianJson.url = 'ppt.png'
          let keJianInfo = {}
          keJianInfo.name = this.$i18n.messages[this.$i18n.locale].m.teachLessonFile
          let keJianAllCount = 0
          let keJianTableData = {}
          let keJiantbodyArray = []
          let index = 0
          let len = 3
          if (lists.length < 3) {
            len = lists.length
          }
          for (let i = 0; i < len; i++) {
            let resulttype1 = lists[i].resulttype
            if (resulttype1 === '2') {
              let arrrays = []
              let gradename1 = lists[i].gradename
              let resultcount1 = lists[i].resultcount
              arrrays[0] = gradename1
              arrrays[1] = resultcount1
              keJiantbodyArray[index] = arrrays
              keJianAllCount += resultcount1
              index = index + 1
            }
          }
          keJianInfo.value = keJianAllCount
          keJianJson.info = keJianInfo
          keJianJson.title = this.$i18n.messages[this.$i18n.locale].m.lessonFileResult + '(' + this.$i18n.messages[this.$i18n.locale].m.month + ')TOP3'
          keJianTableData.thead = [this.$i18n.messages[this.$i18n.locale].m.grade, this.$i18n.messages[this.$i18n.locale].m.num]
          keJianTableData.tbody = keJiantbodyArray
          keJianJson.tableData = keJianTableData
          resultData[1] = keJianJson
        }
        // 研讨成果
        if (data.pageInfo.list) {
          let lists = data.pageInfo.list
          let yanTaoJson = {}
          yanTaoJson.url = 'discuss.png'
          let yanTaoInfo = {}
          yanTaoInfo.name = this.$i18n.messages[this.$i18n.locale].m.teachLessonFile
          let yanTaoAllCount = 0
          let yanTaoTableData = {}
          let yanTaotbodyArray = []
          let indexs = 0
          let len = 3
          if (lists.length < 3) {
            len = lists.length
          }
          for (let i = 0; i < len; i++) {
            let resulttype2 = lists[i].resulttype
            if (resulttype2 === '3') {
              let array = []
              let gradename2 = lists[i].gradename
              let resultcount2 = lists[i].resultcount
              array[0] = gradename2
              array[1] = resultcount2
              yanTaotbodyArray[indexs] = array
              yanTaoAllCount += resultcount2
              indexs = indexs + 1
            }
          }
          yanTaoInfo.value = yanTaoAllCount
          yanTaoJson.info = yanTaoInfo
          yanTaoJson.title = this.$i18n.messages[this.$i18n.locale].m.discussResult + '(' + this.$i18n.messages[this.$i18n.locale].m.month + ')TOP3'
          yanTaoTableData.thead = [this.$i18n.messages[this.$i18n.locale].m.grade, this.$i18n.messages[this.$i18n.locale].m.num]
          yanTaoTableData.tbody = yanTaotbodyArray
          yanTaoJson.tableData = yanTaoTableData
          resultData[2] = yanTaoJson
        }
        console.log(resultData)
        this.statistics = resultData
      }
    }, response => {
      console.log('error')
    })
  },
  beforeMount () {
    // 计算表格 作业类型 和完成率 的宽度
    let windowWidth = window.screen.width
    if (windowWidth <= 1920) {
      this.typeWidth = 190
      this.finishWidth = 190
    }
    if (windowWidth <= 1366) {
      this.typeWidth = 140
      this.finishWidth = 135
    }
    if (windowWidth === 1024) {
      this.typeWidth = 'auto'
      this.finishWidth = 'auto'
      this.responsiveHero = false
    }
  },
  mounted () {
    window.onresize = () => {
      this.$refs['echarts_teacherClassBehavior'].resizeChart()
      this.$refs['echarts_classActivity'].resizeChart()
      this.$refs['echarts_classInteraction'].resizeChart()
      this.$refs['echarts_classScoreDistribution'].resizeChart()
      this.$refs['echarts_studentClassBehavior'].resizeChart()
    }
  },
  props: [],
  data: function () {
    return {
      additionalOptions: {
        echarts_teacherClassBehavior: {},
        echarts_classActivity: {},
        echarts_classInteraction: {},
        echarts_classScoreDistribution: {},
        echarts_studentClassBehavior: {}
      },
      hero: [
        {
          id: 1,
          label: this.$i18n.messages[this.$i18n.locale].m.effectiveUserCount,
          value: '0'
        }, {
          id: 2,
          label: this.$i18n.messages[this.$i18n.locale].m.coverClassCount,
          value: '0'
        }, {
          id: 3,
          label: this.$i18n.messages[this.$i18n.locale].m.techLessonCount,
          value: '0'
        }, {
          id: 4,
          label: this.$i18n.messages[this.$i18n.locale].m.lessonExampleCount,
          value: '0'
        }
      ],
      hero1: [
        {
          id: 1,
          label: this.$i18n.messages[this.$i18n.locale].m.effectiveUserCount,
          value: '0'
        }, {
          id: 2,
          label: this.$i18n.messages[this.$i18n.locale].m.coverClassCount,
          value: '0'
        }, {
          id: 3,
          label: this.$i18n.messages[this.$i18n.locale].m.techLessonCount,
          value: '0'
        }, {
          id: 4,
          label: this.$i18n.messages[this.$i18n.locale].m.lessonExampleCount,
          value: '0'
        }
      ],
      distBox: {
        // 请用,设置换行
        dist1: '无'
      },
      teacherUseRate: '0%',
      lectureCount: '0',
      toolTotalCount: `${this.$i18n.messages[this.$i18n.locale].m.zhlessonAppCount} : 0`,
      tableData: [],
      statistics: [],
      typeWidth: 150,
      finishWidth: 150,
      // 第二屏的hero是否展示?
      responsiveHero: true
    }
  },
  components: {
    TwCard,
    TwEcharts,
    TwDistBox,
    TwCircle,
    TwStatistics
  },
  methods: {
    simulationTime: function () {
      // 模拟本月活跃用户数滚动
      let tempChart = echarts.init(document.getElementById('echarts_teacherClassBehavior'))
      let flag = tempChart.getOption().xAxis[0].data.length
      let index = 0
      setInterval(() => {
        if (index + 7 > flag) {
          index = 0
        }
        tempChart.dispatchAction({
          type: 'dataZoom',
          // 开始位置的数值
          startValue: index,
          // 结束位置的数值
          endValue: index + 7
        })
        index += 1
      }, 2000)
    },
    simulationTime1: function () {
      let tempChart = echarts.init(document.getElementById('echarts_studentClassBehavior'))
      let flag = tempChart.getOption().xAxis[0].data.length
      let index = 0
      setInterval(() => {
        if (index + 7 > flag) {
          index = 0
        }
        tempChart.dispatchAction({
          type: 'dataZoom',
          // 开始位置的数值
          startValue: index,
          // 结束位置的数值
          endValue: index + 6
        })
        index += 1
      }, 2000)
    }
  }
}
</script>

<style scoped></style>
